const express = require( 'express' );
const bodyParser = require( 'body-parser' );
const cookieSeesion = require( 'cookie-session' );
const { join } = require( 'path' );
const app = express();
app.listen( 8080 );

app.use( express.static( 'static' ) );

app.use( bodyParser.urlencoded( { extended: false } ) )
app.use( bodyParser.json() );

app.use( cookieSeesion( {
  name: 'bk-2001',
  secret: 'sdjkzgrzjhegbjarhskirauehi',
  maxAge: 20 * 60 * 1000
} ) );

// 指定art-template模板，并指定模块后缀为.html
app.engine( 'html', require( 'express-art-template' ) );
// 指定模板视图路径
app.set( 'views', join( __dirname, 'views' ) );
// 省略指定模块文件后缀后名称
app.set( 'view engine', 'html' );

// app.use( '/admin', require( './routers/admin/login' ) );
// app.use('/admin',require('./routers/admin/welcome'))

app.use( '/admin', require( './routers' ) );